import sqlite3

conn = sqlite3.connect('../database.db')
conn.row_factory = sqlite3.Row

sql = 'select * from gate_info'
result = conn.execute(sql).fetchall()
with open('C:/bangjiang/gate_info', 'w', encoding='utf8') as f:
    for row in result:
        row = list(row)
        for i in range(0, len(row)):
            if row[i] == '\r':
                row[i] = '\n'
            else:
                row[i] = str(row[i])
        line = '@'.join(row)
        f.write(line)
